package com.pai4j.remote.act;

import com.pai4j.common.bean.PAIPageResponseBeanUtil;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.domain.vo.request.request.CommentSaveVO;
import com.pai4j.domain.vo.response.CommentResponseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "pai4j-act-service", contextId = "pai4jActServiceCommentClient")
public interface ICommentClient {

    /**
     * 保存评论
     * @param vo
     * @return
     */
    @PostMapping("/act-service/comment/addComment")
    PAIResponseBean<Long> saveComment(@RequestBody CommentSaveVO vo);

    /**
     * 删除评论
     * @return
     */
    @PostMapping("/act-service/comment/deleteComment/{id}")
    PAIResponseBean deleteComment(@PathVariable Long id, @PathVariable String userId);
    /**
     * 置顶评论
     * @param commentId
     * @return
     */
    @PostMapping("/act-service/comment/top/{commentId}")
    PAIResponseBean<Long> topComment(@PathVariable Long commentId);
    /**
     * 取消置顶评论
     * @param commentId
     * @return
     */
    @PostMapping("/act-service/comment/cancelTop/{commentId}")
    PAIResponseBean<Long> cancelTopComment(@PathVariable Long commentId);

    /***
     * 查询资源评论列表
     * @param resourceId
     * @param resourceType
     * @param isHot
     * @param isNew
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping("/act-service/comment/query")
    PAIPageResponseBeanUtil<List<CommentResponseVO>> queryComments(@RequestParam(value = "resourceId", required = false) Long resourceId,
                                                             @RequestParam(value = "resourceType", required = false) String resourceType,
                                                             @RequestParam(value = "content", required = false) String content,
                                                             @RequestParam(value = "isHot", required = false, defaultValue = "false") Boolean isHot,
                                                             @RequestParam(value = "isNew", required = false, defaultValue = "false") Boolean isNew,
                                                             @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                                             @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);
    /**
     * 批量查询评论数量（走缓存）
     */
    @PostMapping("/act-service/comment/count/batch")
    PAIResponseBean<Map<Long, Long>> batchCount(@RequestBody List<Long> resourceIds,
                                                @RequestParam("resourceType") String resourceType);



}